1. Field of the Invention
The present invention relates to a disk control system and, more particularly, to a disk control system having a read ahead cache for holding data read ahead from a disk unit.
2. Description of the Related Art
In many conventional information processing apparatuses such as a workstation or personal computer, a magnetic disk unit (hard disk drive) is used as a secondary memory. Despite its high reliability in recording and low bit unit cost, the access speed of the magnetic disk unit is low.
More specifically, the operation principle of the magnetic disk unit is that a magnetic head is moved on a disk surface to write/read data on/from the rotating disk. The operation control of such a mechanical movable portion undesirably makes the access speed of the unit low.
Recently, a magnetic disk unit having a read ahead cache (read ahead buffer) has been developed to realize rapid data reading. In the unit using the read ahead cache, when data read-requested by a host unit is present in the read ahead cache (cache hit), the data can be immediately sent from the read ahead cache to the host unit without access to the magnetic disk unit. In this case, the read data is determined in a shorter period of time after the host unit issues the read command. A high-performance host unit can thus be obtained. This method is known as read ahead cache method.
The capacity of a general read ahead cache depends on a corresponding disk unit or controller for controlling this disk unit. When the data read-requested by the host unit is not present in the read ahead cache (cache miss hit), the data read out from the disk and data subsequent to this data are newly stored in the read ahead cache, updating the contents of the read ahead cache.
In the conventional method, however, data on the sector subsequent to the sector read-requested by the host unit is unconditionally read ahead in the read ahead cache. For this reason, the hit rate of the read ahead cache is low, and the frequency of read access to the magnetic disk unit or rewrite of the read ahead cache is relatively high.
More specifically, when read access from the host unit is continuously performed in an order of addresses, the hit rate of the read ahead cache is high. However, when a series of related data are written on a plurality of sectors having non-sequential addresses, the read access from the host unit becomes random access at non-sequential addresses, thereby greatly decreasing the hit rate.
A conventional data writing operation in a read ahead cache will be described below with reference to FIGS. 1A and 1B.
When a magnetic disk unit is used for the first time (anew formatted), all sectors on this magnetic disk unit are unused. Normally, data are sequentially written in an order of sector addresses in accordance with an instruction from a host unit. In FIG. 1A, sector data A0 and A1 of a file A are stored at sector addresses (sector number) 1 and 2. Similarly, sector data B0 to B3 of a file B are stored at sector addresses 3 to 6, sector data C0 to C3 of a file C are stored at sector addresses 7 to 10, sector data D0 of a file D is stored at sector address 11, and sector data E0 to E2 of a file E are stored at addresses 12 to 14.
In this state, when the data are rewritten in accordance with the data processing of the host unit, the host unit overwrites new data on the sectors storing unnecessary data. For example, in a state shown in FIG. 1A, when the files A, D, and E are unnecessary and a file Z (sector data Z0 to Z3) is written, the sector data Z0 to Z3 are written on the sectors storing the unnecessary data in the order of addresses, as shown in FIG. 1B. Therefore, the sector data Z0 and Z1 are written at sector addresses 1 and 2, and the sector data Z2 and Z3 are written at sector addresses 11 and 12.
In a state shown in FIG. 1B, when the host unit reads out the sector data Z0 and Z1 at sector addresses 1 and 2 from the magnetic disk unit, and the read ahead cache can store eight sectors, the data (B0, B1, B2, B3, C0, C1, C2, and C3) on the eight sectors subsequent to sector address 2 are stored in the read ahead cache.
Normally, the host unit continuously reads out the related data. Therefore, it is likely that the data Z2 and Z3 which belong to the same file as in the sector data Z0 and z1 are subsequently read out. In this case, a miss hit of the read ahead cache occurs, and access to the magnetic disk unit is performed again. The host unit, therefore, must wait until the sector data Z2 and Z3 are read from the magnetic disk unit in accordance with the access.
As described above, in the conventional method, when the related data are sequentially written in the order of sector addresses, the hit rate of the read ahead cache is increased so that data can be efficiently supplied. However, for example, when a series of related data are written on a plurality of sectors having non-sequential addresses, read access from the host unit becomes access at non-sequential addresses to greatly decrease the hit rate of the read ahead cache.